package implementations;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;

import interfaces.IMessageBox;

public class MessageBoxImpl extends JFrame implements IMessageBox {

	private JFrame thisFrame;
	private JFrame callerFrame;

	public MessageBoxImpl(String message, JFrame callerFr) {
		callerFrame = callerFr;
		thisFrame = this;
		thisFrame.setLayout(new FlowLayout());
		JTextField textField=new JTextField(message);
		textField.setPreferredSize(new Dimension(270, 100));
		thisFrame.add(textField);
		thisFrame.setBounds(100, 100, 300, 200);		
		JButton OKButton = new JButton("OK");
		OKButton.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				thisFrame.dispose();

				super.mouseClicked(arg0);
			}
		});
		thisFrame.add(OKButton);
		thisFrame.setVisible(true);
		thisFrame.revalidate();
	}
}
